/**
 * 题目链接：2025/10/26 考试 T3 灭魂の丹
 * 完成时间：2025/10/26 17:40
 * 简要思路：
 */
#include <bits/stdc++.h>
#define range(i, b, e) for (auto i(b); i != (e); i++)
#define rep(i, b, e) for (auto i(b); i <= (e); i++)
#define req(i, b, e) for (auto i(b); i >= (e); i--)
using namespace std;
typedef long long LL;
typedef pair<int, int> Pii;

const int N = 100;
int n, m, q;
int fa[N+5];
bool flag[N+5];

int find(int u) {
	return fa[u] == u ? u : fa[u] = find(fa[u]);
}

bool check(int l, int l1, int r1, int r) {
	bool flg = true;
	rep(i, l1, r1) flag[find(i)] = true;
	rep(i, l, l1-1) {
		if (!flag[find(i)]) {
			flg = false;
			break;
		}
	}
	rep(i, r1+1, r) {
		if (!flag[find(i)]) {
			flg = false;
			break;
		}
	}
	rep(i, l1, r1) flag[find(i)] = false;
	return flg;
}

int main() {
	freopen("destory.in", "r", stdin);
	freopen("destory.out", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	cin >> n >> m >> q;
	iota(fa + 1, fa + n + 1, 1);
	for (int u, v; m--;) {
		cin >> u >> v;
		fa[find(u)] = find(v);
	}
	for (int l, r; q--;) {
		cin >> l >> r;
		int ans = r-l+1;
		rep(l1, l, r) rep(r1, l1, r) {
			if (check(l, l1, r1, r)) ans = min(ans, r1-l1+1);
		}
		cout << ans << '\n';
	}
	return 0;
}
